// Author: wsfuyibing <682805@qq.com>
// Date: 2025-06-26

package kind

// LockedState
// 锁定状态.
type LockedState int

const (
	LockedStateNot LockedState = iota
	LockedStateLocked
	LockedStateConsumed
	LockedStateReleased
)

var (
	lockedStateTexts = map[LockedState]string{
		LockedStateNot:      "未锁定",
		LockedStateLocked:   "已锁定",
		LockedStateConsumed: "已消费",
		LockedStateReleased: "已解锁",
	}
	lockedStateFlags = map[LockedState]string{
		LockedStateLocked:   "locked",
		LockedStateConsumed: "consumed",
		LockedStateReleased: "released",
	}
)

func (o LockedState) Flag() string {
	if str, ok := lockedStateFlags[o]; ok {
		return str
	}
	return ""
}

func (o LockedState) IsNot() bool      { return o == LockedStateNot }
func (o LockedState) IsLocked() bool   { return o == LockedStateLocked }
func (o LockedState) IsConsumed() bool { return o == LockedStateConsumed }
func (o LockedState) IsReleased() bool { return o == LockedStateReleased }

func (o LockedState) Text() string {
	if str, ok := lockedStateTexts[o]; ok {
		return str
	}
	return ""
}
